[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
                               EOF function

 TEXT FILES 

  DECLARATION:  EOF(var F : Text);

      PURPOSE:  Return the end of file status of a file

         UNIT:  System

  RESULT TYPE:  Boolean

      REMARKS:  If specified, F is a text file variable, else the
                standard file variable Input is assumed.  EOF(F)
                returns TRUE if the current file position is beyond the
                last character or if the file contains no components, else
                it returns FALSE.

                NOTE: With {$I-}, errors are returned through IOResult

 TYPED, UNTYPED FILES 

  DECLARATION:  EOF(var F);

  RESULT TYPE:  Boolean

      REMARKS:  F is a file variable.  EOF(F) returns TRUE if the
                current file position is beyond the last component or if the
                file contains no components, else it returns FALSE.

                NOTE: With {$I-}, errors are returned through IOResult

      EXAMPLE:  Program TestEOF;        (* Text file example *)

                Var
                   F  : Text;
                   Ch : Char;

                Begin
                   Assign(F,'TEST_EOF.PAS');
                   {$I-}
                   Reset(F);
                   {$I+}
                   If IOResult <> 0 then
                   Begin
                      Writeln('File not found');
                      Halt;
                   End;
                   While not EOF(F) do
                   Begin
                      Read(F,Ch);
                      Write(Ch);
                   End;
                   Close(F);
                End.

See Also: Assign Append Close EOLN Erase Reset ReWrite
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson